using System;
using System.Collections.Generic;
using UnityEngine;

public class CameraButton : MonoBehaviour
{
	public UILabel label;

	public HumanPlayerCamera currentCameraBehaviour
	{
		get
		{
			List<HumanPlayerCamera> humanCameras = CameraSettings.instance.humanCameras;
			return humanCameras[GGPlayerSettings.instance.Model.usedCameraView % humanCameras.Count];
		}
	}

	public event Action onCameraChanged;

	private void Awake()
	{
		UpdateLabel();
	}

	private void UpdateLabel()
	{
		label.text = GGPlayerSettings.instance.Model.usedCameraView.ToString();
	}

	public void OnClick()
	{
		GGPlayerSettings.instance.Model.usedCameraView = (GGPlayerSettings.instance.Model.usedCameraView + 1) % CameraSettings.instance.humanCameras.Count;
		GGPlayerSettings.instance.Save();
		UpdateLabel();
		if (this.onCameraChanged != null)
		{
			this.onCameraChanged();
		}
	}
}
